{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 独立使用django model（一）\n",
    "# Django Shell\n",
    "# 项目根目录中打开Django Shell : python manage.py shell\n",
    "# import django\n",
    "# django.setup()  # 装载Django\n",
    "\n",
    "# 独立使用django model（二）\n",
    "# python ×××.py or Jupyter Notebook\n",
    "# 将脚本放置在项目根目录下jupyter_notebook文件中比较方便\n",
    "import sys\n",
    "import os\n",
    "import json\n",
    "import requests\n",
    "from django.core.files import File\n",
    "from django.core.files.base import ContentFile\n",
    "# 外部脚本链接django项目\n",
    "# 添加环境变量\n",
    "'''\n",
    "print(os.path.abspath('__file__'))\n",
    "print(os.path.dirname(os.path.abspath('__file__')))\n",
    "print(os.path.dirname(os.path.dirname(os.path.abspath('__file__'))))\n",
    "/Users/zhaojinhui/Desktop/webapp/backend/rmis/jupyter_notebook/__file__\n",
    "/Users/zhaojinhui/Desktop/webapp/backend/rmis/jupyter_notebook\n",
    "/Users/zhaojinhui/Desktop/webapp/backend/rmis\n",
    "'''\n",
    "project = os.path.dirname(os.getcwd())  # get current work directory\n",
    "sys.path.append(project)\n",
    "sys.path.append(os.path.join(project, 'rmis'))\n",
    "# sys.path.append已设置临时环境变量，可以直接调用其中的文件，脚本是外部脚本，只是放在了项目当中而已\n",
    "os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')\n",
    "# 相关数据库配置等都在settings.py文件中\n",
    "# 导入并装载django\n",
    "import django\n",
    "django.setup()\n",
    "# 脚本正文"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>amount</th>\n",
       "      <th>created</th>\n",
       "      <th>delivered</th>\n",
       "      <th>discount</th>\n",
       "      <th>fk_good</th>\n",
       "      <th>fk_purchase</th>\n",
       "      <th>fk_sale</th>\n",
       "      <th>id</th>\n",
       "      <th>info</th>\n",
       "      <th>interests</th>\n",
       "      <th>modified</th>\n",
       "      <th>quantity</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>735</td>\n",
       "      <td>2018-06-10 00:00:00.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>2465.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3988</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2019-04-15 15:02:36.571920</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>245</td>\n",
       "      <td>2017-09-18 00:00:00.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>2360.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4154</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2019-04-15 15:02:37.873911</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>490</td>\n",
       "      <td>2017-12-22 00:00:00.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>2391.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4178</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2019-04-15 15:02:38.107220</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>245</td>\n",
       "      <td>2017-05-16 00:00:00.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>2315.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4359</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2019-04-15 15:02:39.854166</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>198</td>\n",
       "      <td>2019-02-06 10:25:59.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>17313.0</td>\n",
       "      <td>22489</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:17.098177</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>198</td>\n",
       "      <td>2019-01-23 14:39:01.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>17263.0</td>\n",
       "      <td>22594</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:18.239901</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>198</td>\n",
       "      <td>2019-01-18 12:15:44.000001</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>17252.0</td>\n",
       "      <td>22628</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:18.599036</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>198</td>\n",
       "      <td>2019-01-10 13:00:03.999999</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>17232.0</td>\n",
       "      <td>22667</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:19.040724</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>99</td>\n",
       "      <td>2018-12-19 17:22:19.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>17167.0</td>\n",
       "      <td>22797</td>\n",
       "      <td>None</td>\n",
       "      <td>50.0</td>\n",
       "      <td>2019-04-15 16:09:20.151645</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>198</td>\n",
       "      <td>2018-12-15 17:09:41.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>17152.0</td>\n",
       "      <td>22826</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:20.460713</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>99</td>\n",
       "      <td>2018-11-22 17:44:46.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>17073.0</td>\n",
       "      <td>22981</td>\n",
       "      <td>None</td>\n",
       "      <td>50.0</td>\n",
       "      <td>2019-04-15 16:09:21.786462</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>198</td>\n",
       "      <td>2018-10-31 12:17:12.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16998.0</td>\n",
       "      <td>23134</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:23.033923</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>198</td>\n",
       "      <td>2018-09-22 11:50:17.000001</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16882.0</td>\n",
       "      <td>23358</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:25.124623</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>99</td>\n",
       "      <td>2018-09-12 13:20:38.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16850.0</td>\n",
       "      <td>23417</td>\n",
       "      <td>None</td>\n",
       "      <td>50.0</td>\n",
       "      <td>2019-04-15 16:09:25.674436</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>198</td>\n",
       "      <td>2018-07-25 18:18:44.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16706.0</td>\n",
       "      <td>23685</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:28.070418</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>99</td>\n",
       "      <td>2018-07-16 14:18:04.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16675.0</td>\n",
       "      <td>23744</td>\n",
       "      <td>None</td>\n",
       "      <td>50.0</td>\n",
       "      <td>2019-04-15 16:09:28.652556</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>99</td>\n",
       "      <td>2018-05-30 20:52:45.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16536.0</td>\n",
       "      <td>23997</td>\n",
       "      <td>None</td>\n",
       "      <td>50.0</td>\n",
       "      <td>2019-04-15 16:09:30.919076</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>99</td>\n",
       "      <td>2018-03-29 16:19:24.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16355.0</td>\n",
       "      <td>24334</td>\n",
       "      <td>None</td>\n",
       "      <td>50.0</td>\n",
       "      <td>2019-04-15 16:09:34.263286</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>198</td>\n",
       "      <td>2018-03-18 17:37:18.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16315.0</td>\n",
       "      <td>24398</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:34.903477</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>198</td>\n",
       "      <td>2018-02-24 17:26:56.000000</td>\n",
       "      <td>None</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64</td>\n",
       "      <td>NaN</td>\n",
       "      <td>16244.0</td>\n",
       "      <td>24515</td>\n",
       "      <td>None</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2019-04-15 16:09:36.172155</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    amount                    created delivered  discount  fk_good  \\\n",
       "0      735 2018-06-10 00:00:00.000000      None       0.0       64   \n",
       "1      245 2017-09-18 00:00:00.000000      None       0.0       64   \n",
       "2      490 2017-12-22 00:00:00.000000      None       0.0       64   \n",
       "3      245 2017-05-16 00:00:00.000000      None       0.0       64   \n",
       "0      198 2019-02-06 10:25:59.000000      None       0.0       64   \n",
       "1      198 2019-01-23 14:39:01.000000      None       0.0       64   \n",
       "2      198 2019-01-18 12:15:44.000001      None       0.0       64   \n",
       "3      198 2019-01-10 13:00:03.999999      None       0.0       64   \n",
       "4       99 2018-12-19 17:22:19.000000      None       0.0       64   \n",
       "5      198 2018-12-15 17:09:41.000000      None       0.0       64   \n",
       "6       99 2018-11-22 17:44:46.000000      None       0.0       64   \n",
       "7      198 2018-10-31 12:17:12.000000      None       0.0       64   \n",
       "8      198 2018-09-22 11:50:17.000001      None       0.0       64   \n",
       "9       99 2018-09-12 13:20:38.000000      None       0.0       64   \n",
       "10     198 2018-07-25 18:18:44.000000      None       0.0       64   \n",
       "11      99 2018-07-16 14:18:04.000000      None       0.0       64   \n",
       "12      99 2018-05-30 20:52:45.000000      None       0.0       64   \n",
       "13      99 2018-03-29 16:19:24.000000      None       0.0       64   \n",
       "14     198 2018-03-18 17:37:18.000000      None       0.0       64   \n",
       "15     198 2018-02-24 17:26:56.000000      None       0.0       64   \n",
       "\n",
       "    fk_purchase  fk_sale     id  info  interests                   modified  \\\n",
       "0        2465.0      NaN   3988  None        NaN 2019-04-15 15:02:36.571920   \n",
       "1        2360.0      NaN   4154  None        NaN 2019-04-15 15:02:37.873911   \n",
       "2        2391.0      NaN   4178  None        NaN 2019-04-15 15:02:38.107220   \n",
       "3        2315.0      NaN   4359  None        NaN 2019-04-15 15:02:39.854166   \n",
       "0           NaN  17313.0  22489  None      100.0 2019-04-15 16:09:17.098177   \n",
       "1           NaN  17263.0  22594  None      100.0 2019-04-15 16:09:18.239901   \n",
       "2           NaN  17252.0  22628  None      100.0 2019-04-15 16:09:18.599036   \n",
       "3           NaN  17232.0  22667  None      100.0 2019-04-15 16:09:19.040724   \n",
       "4           NaN  17167.0  22797  None       50.0 2019-04-15 16:09:20.151645   \n",
       "5           NaN  17152.0  22826  None      100.0 2019-04-15 16:09:20.460713   \n",
       "6           NaN  17073.0  22981  None       50.0 2019-04-15 16:09:21.786462   \n",
       "7           NaN  16998.0  23134  None      100.0 2019-04-15 16:09:23.033923   \n",
       "8           NaN  16882.0  23358  None      100.0 2019-04-15 16:09:25.124623   \n",
       "9           NaN  16850.0  23417  None       50.0 2019-04-15 16:09:25.674436   \n",
       "10          NaN  16706.0  23685  None      100.0 2019-04-15 16:09:28.070418   \n",
       "11          NaN  16675.0  23744  None       50.0 2019-04-15 16:09:28.652556   \n",
       "12          NaN  16536.0  23997  None       50.0 2019-04-15 16:09:30.919076   \n",
       "13          NaN  16355.0  24334  None       50.0 2019-04-15 16:09:34.263286   \n",
       "14          NaN  16315.0  24398  None      100.0 2019-04-15 16:09:34.903477   \n",
       "15          NaN  16244.0  24515  None      100.0 2019-04-15 16:09:36.172155   \n",
       "\n",
       "    quantity  \n",
       "0         15  \n",
       "1          5  \n",
       "2         10  \n",
       "3          5  \n",
       "0          2  \n",
       "1          2  \n",
       "2          2  \n",
       "3          2  \n",
       "4          1  \n",
       "5          2  \n",
       "6          1  \n",
       "7          2  \n",
       "8          2  \n",
       "9          1  \n",
       "10         2  \n",
       "11         1  \n",
       "12         1  \n",
       "13         1  \n",
       "14         2  \n",
       "15         2  "
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from datetime import datetime\n",
    "from django.forms import model_to_dict\n",
    "from good.models import Good\n",
    "from invoice.models import GoodInSale, GoodInPurchase\n",
    "\n",
    "# df_good = pd.DataFrame.from_records(Good.objects.all().values(\"id\",\"num\",\"price_sell\",\"price_purchase\"))  # __init__不启用\n",
    "goods = [ model_to_dict(good) for good in Good.objects.all() ]\n",
    "df_good = pd.DataFrame.from_records(goods)\n",
    "\n",
    "# 卖光的 和 没卖光的\n",
    "df_inventory = df_good[lambda x:x.num >0]\n",
    "df_inventory = df_inventory.rename(columns={\"id\":\"good_id\",\"num\":\"inventory\"})\n",
    "df_inventory = df_inventory[[\"good_id\",\"code\",\"title\",\"inventory\"]].sort_values(by=\"inventory\",ascending=False)\n",
    "series_item_data = []\n",
    "for good in df_inventory.to_dict(orient=\"records\"):\n",
    "    series_item_data.append({\n",
    "        \"name\":good[\"title\"],\n",
    "        \"y\":good[\"inventory\"],\n",
    "        \"colorByPoint\": True,\n",
    "        \"drilldown\":good[\"good_id\"],\n",
    "    })\n",
    "\n",
    "\n",
    "# filter: store good created\n",
    "\n",
    "goodsinsale =  [ model_to_dict(good) for good in GoodInSale.objects.filter(fk_good=64, fk_sale__fk_clerk__fk_store=5,created__lte=datetime.now()) ]\n",
    "goodsinpurchase =  [ model_to_dict(good) for good in GoodInPurchase.objects.filter( fk_good=64, fk_purchase__fk_clerk__fk_store=5, created__lte=min( datetime.now(), datetime(2019,5,18) ) ) ]\n",
    "df_good_in_sale = pd.DataFrame.from_records(goodsinsale)\n",
    "df_good_in_purchase = pd.DataFrame.from_records(goodsinpurchase)\n",
    "\n",
    "# fk_good quantity created\n",
    "\n",
    "# df_good_in_sale = df_good_in_sale[[\"created\",\"quantity\"]]\n",
    "# df_good_in_sale[\"quantity\"] = -df_good_in_sale[\"quantity\"]\n",
    "# df_good_in_sale\n",
    "\n",
    "# df_good_in_purchase = df_good_in_purchase[[\"created\",\"quantity\"]]\n",
    "# df_good_in_purchase\n",
    "\n",
    "# df_trans = pd.concat([ df_good_in_purchase, df_good_in_sale ])\n",
    "# # df_trans = df_trans.set_index(\"created\").sort_index()\n",
    "# df_trans = df_trans.sort_values(\"created\")\n",
    "# df_trans[\"quantity\"] = df_trans[\"quantity\"].cumsum()\n",
    "# df_trans[\"created\"] = df_trans[\"created\"].apply(\n",
    "#     lambda x: int(x.timestamp()) * 1000\n",
    "# )\n",
    "# df_trans\n",
    "# drilldown_series_item = {\n",
    "#     \"id\":64,\n",
    "#     \"data\":df_trans.to_dict(orient=\"split\")[\"data\"],\n",
    "# } \n",
    "\n",
    "# drilldown_series_item \n",
    "\n",
    "df_trans = pd.concat([ df_good_in_purchase, df_good_in_sale ], sort=True)\n",
    "df_trans\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'id': 44,\n",
       "  'inventory': 51,\n",
       "  'title': '【特别尺码】女装 (UT) S Sanderson BRA连衣裙(无袖) 416106'},\n",
       " {'id': 33, 'inventory': 41, 'title': '女装 睡衣(长袖) 413956'},\n",
       " {'id': 61, 'inventory': 37, 'title': '女装 (UT) S Sanderson印花T恤(短袖) 414510'},\n",
       " {'id': 70, 'inventory': 34, 'title': '女装 (UT) Super Geo印花T恤(短袖) 418024'},\n",
       " {'id': 8, 'inventory': 32, 'title': '女装 (UT) SANRIO睡衣(长袖) 416641'},\n",
       " {'id': 4, 'inventory': 30, 'title': '女装 风衣 415317'},\n",
       " {'id': 18,\n",
       "  'inventory': 28,\n",
       "  'title': '女装 HEATTECH EXTRA WARM U领T恤(八分袖) 408241'},\n",
       " {'id': 74, 'inventory': 28, 'title': '女装 (UT) Super Geo印花T恤(短袖) 417561'},\n",
       " {'id': 40, 'inventory': 26, 'title': '女装 高弹力牛仔裤(水洗产品) (裤脚开衩) 409941'},\n",
       " {'id': 6, 'inventory': 23, 'title': '女装 前排扣大摆裙 417763'},\n",
       " {'id': 57, 'inventory': 22, 'title': '女装 (UT) S Sanderson印花T恤(短袖) 416147'},\n",
       " {'id': 36, 'inventory': 22, 'title': '女装 EZY九分裤 415224'},\n",
       " {'id': 84, 'inventory': 21, 'title': '【特别尺码】女装 (UT)SPRZ NY印花T恤(短袖) 417651'},\n",
       " {'id': 43,\n",
       "  'inventory': 21,\n",
       "  'title': '【特别尺码】女装 (UT) S Sanderson BRA连衣裙(无袖) 416107'},\n",
       " {'id': 77, 'inventory': 21, 'title': '女装 (UT)SPRZ NY印花T恤(短袖) 417648'},\n",
       " {'id': 67, 'inventory': 19, 'title': '女装 (UT) Super Geo印花T恤(短袖) 418025'},\n",
       " {'id': 22, 'inventory': 19, 'title': '女装 EZY九分裤 415222'},\n",
       " {'id': 29, 'inventory': 19, 'title': '女装 SUPIMA COTTON弹力衬衫(长袖) 414148'},\n",
       " {'id': 68, 'inventory': 19, 'title': '女装 (UT) Super Geo印花T恤(短袖) 417644'},\n",
       " {'id': 32, 'inventory': 18, 'title': '女装 3D全棉休闲V领针织衫(七分袖) 413625'},\n",
       " {'id': 37,\n",
       "  'inventory': 17,\n",
       "  'title': '【特别尺码】女装 HEATTECH EXTRA WARMU领T恤(八分袖) 408241'},\n",
       " {'id': 56, 'inventory': 17, 'title': '女装 (UT) S Sanderson印花T恤(短袖) 416148'},\n",
       " {'id': 10, 'inventory': 17, 'title': '女装 蝙蝠袖针织衫(长袖) 415379'},\n",
       " {'id': 14, 'inventory': 16, 'title': '女装 前排扣大摆裙 416218'},\n",
       " {'id': 20, 'inventory': 16, 'title': '女装 窄身裙 417639'},\n",
       " {'id': 39, 'inventory': 15, 'title': '女装 条纹连衣裙(长袖) 415482'},\n",
       " {'id': 17, 'inventory': 14, 'title': '女装 HEATTECH EXTRA WARM圆领T恤(长袖) 408240'},\n",
       " {'id': 71, 'inventory': 14, 'title': '女装 (UT) Super Geo印花T恤(短袖) 414511'},\n",
       " {'id': 81, 'inventory': 13, 'title': '【特别尺码】女装 (UT)SPRZ NY印花T恤(短袖) 417649'},\n",
       " {'id': 23, 'inventory': 13, 'title': '女装 棉混纺宽松船领长针织衫(长袖) 415364'},\n",
       " {'id': 73, 'inventory': 10, 'title': '女装 (UT) Super Geo印花T恤(短袖) 417643'},\n",
       " {'id': 79, 'inventory': 10, 'title': '【特别尺码】女装 (UT)SPRZ NY印花T恤(短袖) 417648'},\n",
       " {'id': 42, 'inventory': 9, 'title': '女装 (UT) S Sanderson BRA连衣裙(无袖) 416105'},\n",
       " {'id': 64, 'inventory': 9, 'title': '女装 棉混纺宽松船领长针织衫(长袖) 415364'},\n",
       " {'id': 5, 'inventory': 7, 'title': '女装 3D全棉罗纹连衣裙(五分袖) 414214'},\n",
       " {'id': 2, 'inventory': 6, 'title': '女装 条纹连衣裙(长袖) 415482'},\n",
       " {'id': 76, 'inventory': 6, 'title': '【特别尺码】女装 (UT)SPRZ NY印花T恤(短袖) 417654'},\n",
       " {'id': 45, 'inventory': 5, 'title': '女装 (UT) S Sanderson BRA连衣裙(无袖) 416107'},\n",
       " {'id': 31, 'inventory': 4, 'title': '女装 防紫外线针织茄克 414202'},\n",
       " {'id': 35, 'inventory': 4, 'title': '女装 睡衣(长袖) 415644'},\n",
       " {'id': 46, 'inventory': 4, 'title': '女装 (UT) S Sanderson BRA连衣裙(无袖) 416106'},\n",
       " {'id': 63, 'inventory': 4, 'title': '女装 (UT) S Sanderson全棉衬衫(短袖) 416358'},\n",
       " {'id': 19, 'inventory': 3, 'title': '女装 窄身裙 417640'},\n",
       " {'id': 62, 'inventory': 3, 'title': '女装 (UT) S Sanderson印花T恤(短袖) 414510'},\n",
       " {'id': 3, 'inventory': 3, 'title': '女装 条纹连衣裙(长袖) 413821'},\n",
       " {'id': 87, 'inventory': 2, 'title': 'TestGoodA'},\n",
       " {'id': 28, 'inventory': 1, 'title': '女装 EZY棉质九分裤 417637'},\n",
       " {'id': 51,\n",
       "  'inventory': 1,\n",
       "  'title': '【特别尺码】女装 (UT) S Sanderson印花T恤(短袖) 416147'}]"
      ]
     },
     "execution_count": 148,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
